package shape2D;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.layout.*;
import javafx.scene.shape.*;
import javafx.scene.paint.Color;

// 直线   
public class LineDemo extends Application {
	private Pane root = new Pane();
	private Line line;
	
	public static void main(String[] args) {
		Application.launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		for(int i=0; i<8; i++) {
			line = new Line(100, 10, 100, 190);   // 四个坐标决定直线 
			line.setStroke(Color.BLUEVIOLET);   
			line.setStrokeWidth(5);
			line.setOpacity(0.5);  
			line.setRotate(i*22.5);
			root.getChildren().add(line);
		}
		
//		Line line1 = new Line(30, 200, 150, 200);  
//		line1.getStrokeDashArray().addAll(7d, 6d);	// 实现虚线（实线长度加虚线长度）
//		root.getChildren().add(line1);
		
		Scene scene = new Scene(root, 300, 300);
		stage.setScene(scene);
		stage.setTitle("Line");
		stage.show();
	}
}


